<template>
  <div class="app-container">
    <div class="hor  pd-tb10">
      <div class="hor  ver-center">
        <div class="pd-lr10">项目名称:</div>
        <div>{{ this.projectInfo.name }}</div>
        <div class="pd-lr25"></div>
        <div class="pd-lr10">省市:</div>
        <div>{{ this.projectInfo.province + "-" + this.projectInfo.city }}</div>
      </div>
      <div class="flex1 pd-lr10"></div>
      <div class="flex1 pd-lr10"></div>
      <div class="hor  ver-center">
        <el-button type="primary" icon="" size="mini" class="hor"
                   @click="onClickOpen(1)" v-if="pankingProcessList.length > 0">投标报价纵向对比
        </el-button>
        <el-button type="primary" icon="" size="mini" class="hor"
                   @click="onClickOpen(2)" v-if="pankingProcessList.length > 0">综合单价对比
        </el-button>
        <el-button type="primary" slot="reference" :loading="onSaveLoading" class=" mg-l-10"
                   @click="onClickExportPaiMing()">导出排名数据
        </el-button>
        <el-button type="primary" icon="el-icon" size="mini" class="hor"
                   @click="onClickSearch()">刷新
        </el-button>
      </div>
    </div>
    <div class="ver mg-b-10">
      <div class="ver">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="回标1" :name="1"></el-tab-pane>
          <el-tab-pane label="回标2" :name="2"></el-tab-pane>
          <el-tab-pane label="回标3" :name="3"></el-tab-pane>
          <el-tab-pane label="回标4" :name="4"></el-tab-pane>
        </el-tabs>
      </div>

      <div class="ver hor-center">
        <div class="pd-tb25">
          <table class="cus-table match-width" border="1px">
            <div class="loading-overlay">
              <div class="loading-text">加载中...</div>
            </div>
            <tr>
              <th style="width: 40px !important;">类别</th>
              <th style="width: 40px !important;">标底</th>
              <th>投标单位</th>
              <template v-for="(item, index) in pankingProcessList">
                <th>
                  <div class="hor">
                    <div class="hor ver-center pd-l-5">
                      {{ item.supplyCompany != null ? item.supplyCompany.name : null }}
                    </div>
                    <div v-if="item != null && item.supplyCompany != null" class="hor hor-center pd-l-5">
                      <div class="ver" v-if="item != null">
                        <div class="hor">
                          <el-link type="success" size="mini" class=" "
                                   @click="baoJiaZongXiangDuiBi(item)">报价纵向对比
                          </el-link>
                        </div>
                        <div class="hor">
                          <el-link type="danger" size="mini" class=" "
                                   @click="danJiaDuiBi(item)">综合单价对比
                          </el-link>
                        </div>
                        <div class="hor">
                          <el-link type="primary" size="mini" class=" "
                                   @click="zengBuInfo(item,1)">内线增补信息
                          </el-link>
                        </div>
                        <div class="hor">
                          <el-link type="warning" size="mini" class=" "
                                   @click="zengBuInfo(item,2)">外线增补信息
                          </el-link>
                        </div>
                      </div>
                    </div>
                  </div>
                </th>
              </template>
            </tr>
            <!--          综合排名-->
            <tr v-for="index in 1" :key="index">
              <th style="width: 40px !important;">综合排名</th>
              <td style="width: 40px !important;">/</td>
              <td>
                <div class="ver">
                  <div class="tdm">含税报价</div>
                  <div class="tdx"></div>
                  <div class="tdm">排名</div>
                  <div class="tdx"></div>
                  <div class="tdm">不含税报价与最低价%</div>
                  <div class="tdx"></div>
                  <div class="tdm">不含税报价与标底价%</div>
                  <div class="tdx"></div>
                  <div class="tdm">较上一轮差异率%</div>
                  <div class="tdx"></div>
                </div>
              </td>
              <template v-for="(item, index) in pankingProcessList">
                <td v-if="activeName == 1 && item.tempItem1 != null">
                  <div class="ver" v-if="item.tempItem1.supplyCompany != null">
                    <div class="tdm">{{ item.tempItem1.hsBaoJia.toFixed(2) }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ item.tempItem1.paiMing }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem1.bhszdLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem1.bhsbdLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">/</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 2 && item.tempItem2 != null">
                  <div class="ver" v-if="item.tempItem2.supplyCompany != null">
                    <div class="tdm">{{ item.tempItem2.hsBaoJia.toFixed(2) }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ item.tempItem2.paiMing }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem2.bhszdLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem2.bhsbdLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem2.chaYiLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 3 && item.tempItem3 != null">
                  <div class="ver" v-if="item.tempItem3.supplyCompany != null">
                    <div class="tdm">{{ item.tempItem3.hsBaoJia.toFixed(2) }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ item.tempItem3.paiMing }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem3.bhszdLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem3.bhsbdLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem3.chaYiLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 4 && item.tempItem4 != null">
                  <div class="ver" v-if="item.tempItem4.supplyCompany != null">
                    <div class="tdm">{{ item.tempItem4.hsBaoJia.toFixed(2) }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ item.tempItem4.paiMing }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem4.bhszdLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem4.bhsbdLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ (item.tempItem4.chaYiLv * 100).toFixed(2) }}%</div>
                    <div class="tdx"></div>
                  </div>
                </td>
              </template>
            </tr>
            <!--内线排名-->
            <div class="pd-tb10"></div>
            <tr v-for="index in 1" :key="index">
              <th style="width: 40px !important;">内线排名</th>
              <template v-if="pankingProcessList.length > 0" v-for="(item, index) in pankingProcessList">
                <td v-if="index === 0" style="width: 40px !important;">
                  <div class="ver">
                    <span class="tdm">{{ item.innerBid != null ? item.innerBid.hsBaoJia.toFixed(2) : null }}</span>
                    <div class="tdx"></div>
                    <span class="tdm"> / </span>
                    <div class="tdx"></div>
                    <span class="tdm"> / </span>
                    <div class="tdx"></div>
                    <span class="tdm"> / </span>
                    <div class="tdx"></div>
                    <span class="tdm"> / </span>
                    <div class="tdx"></div>
                  </div>
                </td>
              </template>
              <td v-if="pankingProcessList.length == 0" style="width: 40px !important;">/</td>
              <td>
                <div class="ver">
                  <div class="tdm">含税报价</div>
                  <div class="tdx"></div>
                  <div class="tdm">排名</div>
                  <div class="tdx"></div>
                  <div class="tdm">不含税报价与最低价%</div>
                  <div class="tdx"></div>
                  <div class="tdm">不含税报价与标底价%</div>
                  <div class="tdx"></div>
                  <div class="tdm">较上一轮差异率%</div>
                  <div class="tdx"></div>
                </div>
              </td>
              <template v-for="(item, index) in pankingProcessList">
                <td v-if="activeName == 1 && item.tempInner1 != null">
                  <div class="ver" v-if="item.tempInner1.supplyCompany != null">
                    <div class="tdm">{{ item.tempInner1 != null ? item.tempInner1.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ item.tempInner1 != null ? item.tempInner1.paiMing : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner1 != null ? (item.tempInner1.bhszdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner1 != null ? (item.tempInner1.bhsbdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">/</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 2 && item.tempInner2 != null">
                  <div class="ver" v-if="item.tempInner2.supplyCompany != null" style="width: 99%">
                    <div class="tdm">{{ item.tempInner2 != null ? item.tempInner2.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner2 != null ? item.tempInner2.paiMing : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner2 != null ? (item.tempInner2.bhszdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner2 != null ? (item.tempInner2.bhsbdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner2 != null ? (item.tempInner2.chaYiLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 3 && item.tempInner3 != null">
                  <div class="ver" v-if="item.tempInner3.supplyCompany != null" style="width: 99%">
                    <div class="tdm">{{ item.tempInner3 != null ? item.tempInner3.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner3 != null ? item.tempInner3.paiMing : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner3 != null ? (item.tempInner3.bhszdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner3 != null ? (item.tempInner3.bhsbdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner3 != null ? (item.tempInner3.chaYiLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 4 && item.tempInner4 != null">
                  <div class="ver" v-if="item.tempInner4.supplyCompany != null" style="width: 99%">
                    <div class="tdm">{{ item.tempInner4 != null ? item.tempInner4.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner4 != null ? item.tempInner4.paiMing : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner4 != null ? (item.tempInner4.bhszdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempInner4 != null ? (item.tempInner4.bhsbdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <v class="tdm"> {{ item.tempInner4 != null ? (item.tempInner4.chaYiLv * 100).toFixed(2) : null }}%</v>
                    <div class="tdx"></div>
                  </div>
                </td>
              </template>
            </tr>
            <!--外线排名-->
            <div class="pd-tb10"></div>
            <tr v-for="index in 1" :key="index">
              <th style="width: 40px !important;">外线排名</th>
              <template v-if="pankingProcessList.length > 0" v-for="(item, index) in pankingProcessList">
                <td v-if="index === 0" style="width: 40px !important;">
                  <div class="ver">
                    <div class="tdm">{{ item.outerBid != null ? item.outerBid.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> / </div>
                    <div class="tdx"></div>
                    <div class="tdm"> / </div>
                    <div class="tdx"></div>
                    <div class="tdm"> / </div>
                    <div class="tdx"></div>
                    <div class="tdm"> / </div>
                    <div class="tdx"></div>
                  </div>
                </td>
              </template>
              <td v-if="pankingProcessList.length == 0" style="width: 40px !important;">/</td>
              <td>
                <div class="ver">
                  <div class="tdm">含税报价</div>
                  <div class="tdx"></div>
                  <div class="tdm">排名</div>
                  <div class="tdx"></div>
                  <div class="tdm">不含税报价与最低价%</div>
                  <div class="tdx"></div>
                  <div class="tdm">不含税报价与标底价%</div>
                  <div class="tdx"></div>
                  <div class="tdm">较上一轮差异率%</div>
                  <div class="tdx"></div>
                </div>
              </td>
              <template v-for="(item, index) in pankingProcessList">
                <td v-if="activeName == 1 && item.tempOuter1 != null">
                  <div class="ver" v-if="item.tempOuter1.supplyCompany != null" style="width: 99%">
                    <div class="tdm">{{ item.tempOuter1 != null ? item.tempOuter1.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter1 != null ? item.tempOuter1.paiMing : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter1 != null ? (item.tempOuter1.bhszdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ item.tempOuter1 != null ? (item.tempOuter1.bhsbdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">/</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 2 && item.tempOuter2 != null">
                  <div class="ver" v-if="item.tempOuter2.supplyCompany != null" style="width: 99%">
                    <div class="tdm">{{ item.tempOuter2 != null ? item.tempOuter2.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter2 != null ? item.tempOuter2.paiMing : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter2 != null ? (item.tempOuter2.bhszdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter2 != null ? (item.tempOuter2.bhsbdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ item.tempOuter2 != null ? (item.tempOuter2.chaYiLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 3 && item.tempOuter3 != null">
                  <div class="ver" v-if="item.tempOuter3.supplyCompany != null" style="width: 99%">
                    <div class="tdm">{{ item.tempOuter3 != null ? item.tempOuter3.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter3 != null ? item.tempOuter3.paiMing : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm">{{ item.tempOuter3 != null ? (item.tempOuter3.bhszdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter3 != null ? (item.tempOuter3.bhsbdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter3 != null ? (item.tempOuter3.chaYiLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                  </div>
                </td>
                <td v-if="activeName == 4 && item.tempOuter4 != null">
                  <div class="ver" v-if="item.tempOuter4.supplyCompany != null" style="width: 99%">
                    <div class="tdm">{{ item.tempOuter4 != null ? item.tempOuter4.hsBaoJia.toFixed(2) : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter4 != null ? item.tempOuter4.paiMing : null }}</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter4 != null ? (item.tempOuter4.bhszdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter4 != null ? (item.tempOuter4.bhsbdLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                    <div class="tdm"> {{ item.tempOuter4 != null ? (item.tempOuter4.chaYiLv * 100).toFixed(2) : null }}%</div>
                    <div class="tdx"></div>
                  </div>
                </td>
              </template>
            </tr>
          </table>
        </div>
      </div>
      <!--      增补信息-->
      <div class="">
        <el-dialog
          title="增补信息"
          :visible.sync="toDialogVisible"
          width="85%"
          height="70%"
          :before-close="handleClose"
          :close-on-click-modal="false">
          <div>
            <el-table
              ref="table"
              width="80%"
              v-loading="listLoading"
              :data="zengBuList"
              :height="autoHeight"
              element-loading-text="Loading"
              border
              fit
              highlight-current-row
            >
              <el-table-column label="分类" align="center" width="100">
                <template slot-scope="scope">
                  {{ scope.row.fenLeiName }}
                </template>
              </el-table-column>
              <el-table-column label="名称" align="center" width="">
                <template slot-scope="scope">
                  {{ scope.row.name }}
                </template>
              </el-table-column>
              <el-table-column label="型号" width="100" align="center">
                <template slot-scope="scope">
                  {{ scope.row.modelCode }}
                </template>
              </el-table-column>
              <el-table-column label="工作内容" width="" align="" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  {{ scope.row.gongZuoNeiRong }}
                </template>
              </el-table-column>
              <el-table-column label="单位" width="60" align="center">
                <template slot-scope="scope">
                  {{ scope.row.unit }}
                </template>
              </el-table-column>
              <el-table-column label="分析分类" width="" align="center">
                <template slot-scope="scope">
                  {{ scope.row.fenXiFenLei }}
                </template>
              </el-table-column>
              <el-table-column label="工程量" width="100" align="center">
                <template slot-scope="scope">
                  {{ scope.row.gongChengLiang }}
                </template>
              </el-table-column>
              <el-table-column label="人工费" width="100" align="center">
                <template slot-scope="scope">
                  {{ scope.row.renGongCost }}
                </template>
              </el-table-column>
              <el-table-column label="主材费" width="100" align="center">
                <template slot-scope="scope">
                  {{ scope.row.zhuCaiCost }}
                </template>
              </el-table-column>
              <el-table-column label="辅材及其他材料费" width="100" align="center">
                <template slot-scope="scope">
                  {{ scope.row.fuCaiCost }}
                </template>
              </el-table-column>
              <el-table-column label="机械费" width="100" align="center">
                <template slot-scope="scope">
                  {{ scope.row.jiXieCost }}
                </template>
              </el-table-column>
              <el-table-column label="企业管理费" width="100" align="center">
                <template slot-scope="scope">
                  {{ scope.row.qiYeCost }}
                </template>
              </el-table-column>
              <el-table-column label="税金" width="" align="center">
                <template slot-scope="scope">
                  {{ scope.row.shuiJin }}
                </template>
              </el-table-column>
              <el-table-column label="综合单价" width="" align="center">
                <template slot-scope="scope">
                  {{ scope.row.comprehensivePrice }}
                </template>
              </el-table-column>
              <el-table-column label="合价" width="" align="center">
                <template slot-scope="scope">
                  {{ scope.row.totalPrice }}
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="hor">
            <div class="flex1"></div>
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="page"
              :page-sizes="[20, 50, 100, 200]"
              :page-size="size"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
              class="mg-t-10">
            </el-pagination>
          </div>
        </el-dialog>
      </div>
    </div>
  </div>
</template>

<script>

import {getCityData} from "@/js/cityData";

const requestSupplier = require('@/api/project/supplyCompany')
const requestBiddingCompany = require('@/api/project/biddingCompany')
const request = require('@/api/comprehensive/statisticalAnalysis')
const requestInner = require('@/api/tabulation/innerTabulation')
const requestOuter = require('@/api/tabulation/outerTabulation')
export default {
  name: "statisticalAnalysis.vue",
  data() {
    return {
      projectInfo: {},
      allList: [],
      pankingProcessList: [],
      page: 1,
      size: 20,
      total: 0,
      autoHeight: 600,//根据屏幕高度自动计算的高度
      //筛选参数
      params: {
        flag: 1,
      },
      listLoading: false,
      onSaveLoading: false,
      areaData: [],
      activeName: 1,
      tempItem: null,
      tempInner: null,
      tempOuter: null,
      zengBuList: [],
      toDialogVisible: false,
      parameterItem:null,
      innerOuterType:null,
    }
  },
  beforeMount() {
    this.autoHeight = document.body.scrollHeight - 220
    this.projectInfo = JSON.parse(this.$route.query.projectInfo)
  },
  mounted() {
    this.areaData = getCityData()
    this.handleClick()
    // this.getRankingProcess()
    //去掉第三级的信息
    for (let i = 0; i < this.areaData.length; i++) {
      if (this.areaData[i].children != null && this.areaData[i].children.length > 0) {
        for (let j = 0; j < this.areaData[i].children.length; j++) {
          this.areaData[i].children[j].children = null
        }
      }
    }
  },
  methods: {
    formatDate(timestamp) {
      const date = new Date(timestamp);
      const year = date.getFullYear();
      const month = String(date.getMonth() + 1).padStart(2, '0');
      const day = String(date.getDate()).padStart(2, '0');
      const hours = String(date.getHours()).padStart(2, '0');
      const minutes = String(date.getMinutes()).padStart(2, '0');
      const seconds = String(date.getSeconds()).padStart(2, '0');

      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    },
    getJieDuanName(value) {
      switch (value) {
        case 1:
          return "标底";
        case 2:
          return "回标1";
        case 3:
          return "回标2";
        case 4:
          return "回标3";
        case 5:
          return "回标4"
        case 6:
          return "定标"
        case 7:
          return "实施标底"
        case 8:
          return "实施定标"
        default:
          return "";
      }
    },
    handleClick() {
      this.getRankingProcess()
    },
    onClickSearch() {
      this.getRankingProcess()
    },
    onClickOpen(type) {
      const {href} = this.$router.resolve({
        path: "/statistic/Dashboard?type=" + type + "&projectInfo=" + JSON.stringify(this.projectInfo)
      })
      window.open(href, '_blank')//新窗口打开页面会卡死所以不开新窗口
    },
    baoJiaZongXiangDuiBi(item) {
      const {href} = this.$router.resolve({
        path: "/statistic/Dashboard?type=" + 5 + "&projectInfo=" + JSON.stringify(this.projectInfo) + "&supplyCompany=" + JSON.stringify(item.supplyCompany)
      })
      window.open(href, '_blank')//新窗口打开页面会卡死所以不开新窗口
    },
    danJiaDuiBi(item) {
      const {href} = this.$router.resolve({
        path: "/statistic/Dashboard?type=" + 6 + "&projectInfo=" + JSON.stringify(this.projectInfo) + "&supplyCompany=" + JSON.stringify(item.supplyCompany)
      })
      window.open(href, '_blank')//新窗口打开页面会卡死所以不开新窗口
    },
    handleClose() {
      this.getRankingProcess()
      this.toDialogVisible = false;
      this.parameterItem = null
      this.innerOuterType = null
      this.page = 1
    },
    //查询清单增补信息
    zengBuInfo(item, innerOuterType) {
      this.parameterItem = item
      this.innerOuterType = innerOuterType
      if (innerOuterType != null && innerOuterType == 1) {
        this.zengBuNeiXianList()
      }
      if (innerOuterType != null && innerOuterType == 2) {
        this.zengBuWaiXianList()
      }
      this.toDialogVisible = true;
    },
    zengBuNeiXianList() {
      this.listLoading = true
      const data = new FormData()
      for (var key in this.params) {//直接去除掉空值的对象
        if (this.isEmpty(this.params[key])) {
          delete this.params[key]
        }
      }
      var supplyCompanyId = 0;
      var jieDuan = 0;
      if (this.activeName == 1 && this.parameterItem != null) {
        supplyCompanyId = this.parameterItem.supplyCompany.id
        jieDuan = 2
      }
      if (this.activeName == 2 && this.parameterItem != null) {
        supplyCompanyId = this.parameterItem.supplyCompany.id
        jieDuan = 3
      }
      if (this.activeName == 3 && this.parameterItem != null) {
        supplyCompanyId = this.parameterItem.supplyCompany.id
        jieDuan = 4
      }
      if (this.activeName == 4 && this.parameterItem != null) {
        supplyCompanyId = this.parameterItem.supplyCompany.id
        jieDuan = 5
      }
      this.params['biddingCompany.supplyCompany.id'] = supplyCompanyId
      this.params['biddingCompany.project.id'] = this.projectInfo.id
      this.params['biddingCompany.innerOuterType'] = this.innerOuterType
      this.params['jieDuan'] = jieDuan
      this.params['nameType2_isnotnull'] = null
      data.append('params', JSON.stringify(this.params))
      data.append('page', this.page)
      data.append('size', this.size)

      const sortList = []
      sortList.push(
        {
          direction: 'desc',
          property: 'createTime'
        }
      )
      data.append('sortJsonStr', JSON.stringify(sortList))
      requestInner.getList(data).then(response => {
          this.zengBuList = response.data
          this.total = response.totalElements
          this.listLoading = false
      })
    },
    zengBuWaiXianList() {
      this.listLoading = true
      const data = new FormData()
      for (var key in this.params) {//直接去除掉空值的对象
        if (this.isEmpty(this.params[key])) {
          delete this.params[key]
        }
      }
      let supplyCompanyId = 0;
      let jieDuan = 0;
      if (this.activeName == 1 && this.parameterItem != null) {
        supplyCompanyId = this.parameterItem.supplyCompany.id
        jieDuan = 2
      }
      if (this.activeName == 2 && this.parameterItem != null) {
        supplyCompanyId = this.parameterItem.supplyCompany.id
        jieDuan = 3
      }
      if (this.activeName == 3 && this.parameterItem != null) {
        supplyCompanyId = this.parameterItem.supplyCompany.id
        jieDuan = 4
      }
      if (this.activeName == 4 && this.parameterItem != null) {
        supplyCompanyId = this.parameterItem.supplyCompany.id
        jieDuan = 5
      }
      this.params['biddingCompany.supplyCompany.id'] = supplyCompanyId
      this.params['biddingCompany.project.id'] = this.projectInfo.id
      this.params['biddingCompany.innerOuterType'] = this.innerOuterType
      this.params['jieDuan'] = jieDuan
      this.params['nameType2_isnotnull'] = null
      data.append('params', JSON.stringify(this.params))
      data.append('page', this.page)
      data.append('size', this.size)

      const sortList = []
      sortList.push(
        {
          direction: 'desc',
          property: 'createTime'
        }
      )
      data.append('sortJsonStr', JSON.stringify(sortList))
      requestOuter.getList(data).then(response => {
          this.zengBuList = response.data
          this.total = response.totalElements
          this.listLoading = false
      })
    },

    handleSizeChange(val) {
      this.size = val
      // this.zengBuInfo()
      if (this.innerOuterType != null && this.innerOuterType == 1) {
        this.zengBuNeiXianList()
      }
      if (this.innerOuterType != null && this.innerOuterType == 2) {
        this.zengBuWaiXianList()
      }
    },
    handleCurrentChange(val) {
      this.page = val
      // this.zengBuInfo()
      if (this.innerOuterType != null && this.innerOuterType == 1) {
        this.zengBuNeiXianList()
      }
      if (this.innerOuterType != null && this.innerOuterType == 2) {
        this.zengBuWaiXianList()
      }
    },

    getRankingProcess() {
      this.listLoading = true;
      const data = new FormData();
      data.append('projectId', this.projectInfo.id);
      // 构建排序参数
      const sortList = [
        {
          direction: 'desc',
          property: 'createTime'
        }
      ];
      data.append('sortJsonStr', JSON.stringify(sortList));
      request.getRankingProcess(data).then(response => {
        this.pankingProcessList = response.data; // 修正可能的打字错误
        this.total = response.totalElements;
        this.listLoading = false;
        var loadingOverlay = document.querySelector('.loading-overlay');
        if (loadingOverlay) {
          loadingOverlay.style.display = 'none';
        }
      }).catch(error => {
        console.error('Error:', error);
        this.listLoading = false;
        var loadingOverlay = document.querySelector('.loading-overlay');
        if (loadingOverlay) {
          loadingOverlay.style.display = 'none';
        }
      });
    },
    onClickExportPaiMing() {
      // window.open(process.env.VUE_APP_BASE_API + "/mgt/statistical/exportRankingProcess?projectId=" + this.projectInfo.id + "&innerOuterType=" +this.activeName)
      window.open(process.env.VUE_APP_BASE_API + "/mgt/statistical/exportRankingProcess?projectId=" + this.projectInfo.id)
    },


  }
}
</script>

<style scoped>
.cus-table {
  border-collapse: collapse;
  text-align: center;
}

.cus-table td, .cus-table th {
  border: 1px solid #cad9ea;
  color: #424242;
  height: 50px;
}

.cus-table th {
  background-color: #EFEFEF;
  width: 100px;
  color: #414141;
  font-size: 12px;
}

.tdm {
  /*color: #424242;*/
  height: 50px;
  line-height: 50px;
  font-size: 10px;
  width: 120px;
}

.tdx {
  /*border: dashed 1px solid #cad9ea;*/
  color: #424242;
  /*height: 50px;*/
  /*line-height: 50px;*/
  /*font-size: 10px;*/
  width: 100%;
}

.tdx:not(:last-child) {
  border-bottom: 1px solid #cad9ea;
}



.cus-table.match-width {
  position: relative;
}
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}
.loading-text {
  font-size: 20px;
  font-weight: bold;
}
</style>
